//
//  aaaaaaaaaaaaaaaViewController.m
//  TableSelectDemo
//
//  Created by ebeijia on 15/12/22.
//  Copyright © 2015年 ebeijia. All rights reserved.
//

#import "aaaaaaaaaaaaaaaViewController.h"
#import "ViewController1.h"

@interface aaaaaaaaaaaaaaaViewController ()<UIAlertViewDelegate>

@end

@implementation aaaaaaaaaaaaaaaViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor blackColor];
    
    //self.view.userInteractionEnabled = YES;
    
    
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"uuu" message:@"hhhhhhhhhhh" delegate:self cancelButtonTitle:@"quexiao" otherButtonTitles:@"queding", nil];
    [alert show];
    
    
    
//    CGFloat w = self.view.bounds.size.width - 70;
//    CGFloat h = 120;
//    UIView *alertView = [[UIView alloc] initWithFrame:CGRectMake((self.view.bounds.size.width - w) / 2.0f, (self.view.bounds.size.height - h) / 2.0f, w, h)];
//    alertView.backgroundColor = [UIColor whiteColor];
//    alertView.userInteractionEnabled = YES;
//    alertView.layer.masksToBounds = YES;
//    alertView.layer.cornerRadius = 8;
//    [self.view addSubview:alertView];
//    [self.view bringSubviewToFront:alertView];
//    
//    
//    
//    CGFloat alert_w = CGRectGetWidth(alertView.frame);
//    CGFloat alert_h = CGRectGetHeight(alertView.frame);
//    //title
//    UILabel *titleLabel = [self createLabelWithFrame:CGRectMake(0, 20, alert_w, 40) withtitle:@"温馨提示" withFont:17.0f];
//    [alertView addSubview:titleLabel];
//    
//    //message
//    UILabel *messageLabel = [self createLabelWithFrame:CGRectMake(0, CGRectGetMaxY(titleLabel.frame), alert_w, 20) withtitle:@"您未实名认证，是否现在实名认证" withFont:14.0f];
//    [alertView addSubview:messageLabel];
//    
//    NSArray *array = @[@"取消",@"确定"];
//    for (int i = 0; i < 2; i ++) {
//        
//        UIButton *button = [self createButtonWithFrame:CGRectMake(i * alert_w / 2, alert_h - 40, alert_w / 2, 40) withTag:100 + i];
//        [button setTitle:array[i] forState:UIControlStateNormal];
//        [alertView addSubview:button];
//    }
    
    
}

- (void)buttonClick:(UIButton *)button
{
    if (button.tag == 100) {
        [self.view removeFromSuperview];
    }else if (button.tag == 101) {
        ViewController1 *vc = [[ViewController1 alloc] init];
        [self presentViewController:vc animated:YES completion:nil];
    }
}

- (UIButton *)createButtonWithFrame:(CGRect)frame withTag:(int)tag;
{
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = frame;
    [button addTarget:self action:@selector(buttonClick:) forControlEvents:UIControlEventTouchUpInside];
    button.tag = tag;
    button.backgroundColor = [UIColor clearColor];
    [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    
    return button;
}

- (UILabel *)createLabelWithFrame:(CGRect)frame withtitle:(NSString *)title withFont:(CGFloat)afloat
{
    UILabel *label = [[UILabel alloc] initWithFrame:frame];
    
    
    label.backgroundColor = [UIColor clearColor];
    label.text = title;
    label.font = [UIFont systemFontOfSize:afloat];
    label.textColor = [UIColor blackColor];
    label.textAlignment = NSTextAlignmentCenter;
    
    return label;
}

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    if (buttonIndex == 0) {
        NSLog(@"111111111111111111");
    }else if (buttonIndex == 1) {
        NSLog(@"2222222222222222222");
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
